package com.tiancheng.trade.order.enums;

import com.tiancheng.trade.commom.core.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 二维码订单状态枚举
 *
 * @author likailun
 * @date 2021/9/14
 */
@Getter
@AllArgsConstructor
public enum QrOrderStatusEnum implements BaseEnum<String> {

	waiting_pay("WP", "待支付"),
	cancelled("HC", "已取消"),
	PAY_ERROR("ER", "支付失败"),
	paid("AP", "已支付"),
	;

	private String code;
	private String desc;

	public static String getDesc(String code) {
		QrOrderStatusEnum[] businessModeEnums = values();
		for (QrOrderStatusEnum statusEnum : businessModeEnums) {
			if (statusEnum.code().equals(code)) {
				return statusEnum.desc();
			}
		}
		return null;
	}

	public String code() {
		return this.code;
	}

	public String desc() {
		return this.desc;
	}
}
